using System;
#pragma warning disable 3009
#pragma warning disable 3002
#pragma warning disable 3001
namespace TSharp.Core.Util.TypeConvert
{

    /// <summary>
    /// 
    /// </summary>
    /// <author>
    /// tangjingbo
    /// </author>
    /// <remarks>
    /// tangj15 at 2012-5-4 13:20
    /// </remarks>
    public class NullableUInt64TypeDetectorImpl : NullableValueTypeDetector<ulong>
    {
        /// <summary>
        /// Strings the specified detector obj.
        /// </summary>
        /// <param name="detectorObj">The detector obj.</param>
        /// <param name="arg">The arg.</param>
        /// <returns></returns>
        public override ulong? String(string detectorObj, ulong? arg)
        {
            ulong result;
            bool parseSucceed = ulong.TryParse(detectorObj, out result);
            return parseSucceed ? result : arg;
        }

        /// <summary>
        /// Us the int64.
        /// </summary>
        /// <param name="detectorObj">The detector obj.</param>
        /// <param name="arg">The arg.</param>
        /// <returns></returns>
        public override UInt64? UInt64(ulong detectorObj, UInt64? arg)
        {
            return detectorObj;
        }
    }
}